package com.tandashi.springbootstudy01.study.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
/*
 * 调用处理器
 */
public class LogHandler implements InvocationHandler {
    private Object target;

    public LogHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("before log ...");
        Object object = method.invoke(target,args);
        System.out.println("after log ...");
        return object;
    }
}
